<h2>vm_read</h2>
<hr>
<p>
<strong>Function</strong> - Read the specified range of target task's address space.
<h3>SYNOPSIS</h3>
<pre>
<strong>kern_return_t   vm_read</strong>
                <strong>(vm_task_t</strong>                          <var>target_task</var>,
                 <strong>vm_address_t</strong>                           <var>address</var>,
                 <strong>vm_size_t</strong>                                 <var>size</var>,
                 <strong>size</strong>                                  <var>data_out</var>,
                 <strong>target_task</strong>                         <var>data_count</var><strong>);</strong>
</pre>

<h4>Overwrite form:</h4>
<pre>
<strong>kern_return_t   vm_read_overwrite</strong>
                <strong>(vm_task_t</strong>                          <var>target_task</var>,
                 <strong>vm_address_t</strong>                           <var>address</var>,
                 <strong>vm_size_t</strong>                                 <var>size</var>,
                 <strong>pointer_t</strong>                              <var>data_in</var>,
                 <strong>target_task</strong>                         <var>data_count</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>target_task</var> 
<dd>
[in task send right]
The port for the task whose memory is to be read.
<p>
<dt> <var>address</var> 
<dd>
[in scalar]
The address at which to start the read.
<p>
<dt> <var>size</var> 
<dd>
[in scalar]
The number of bytes to read.
<p>
<dt> <var>data_out</var>
<dd>
Out-pointer to dynamic array of bytes returned by the read.
<p>
<dt> <var>data_in</var>
<dd>
In-pointer to array of bytes that will be overwritten with the data returned by the read.
<p>
<dt> <var>data_count</var> 
<dd>
[in/out scalar]
On input, the maximum size of the buffer; on output, the 
size returned (in natural-sized units).
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>vm_read</strong> and <strong>vm_read_overwrite</strong>
functions read a portion of a task's virtual
memory (they enable tasks to read other tasks' memory).
The <strong>vm_read</strong> function returns the data in a dynamically
allocated array of bytes; the <strong>vm_read_overwrite</strong> function
places the data into a caller-specified buffer (the <var>data_in</var>
parameter).
<h3>NOTES</h3>
<p>
This interface is machine word length specific because of the virtual address
parameter.
<h3>RETURN VALUES</h3>
<dl>
<p>
<dt> <strong>KERN_PROTECTION_FAILURE</strong>
<dd>
Specified memory is valid, but does not permit reading.
<p>
<dt> <strong>KERN_INVALID_ADDRESS</strong>
<dd>
The address is illegal or specifies a non-allocated region, or there are 
less than <var>size</var> bytes of data following the address, or the region
specified by the <var>data_in</var> parameter cannot be written to.
</dl>
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="vm_copy.html"><strong>vm_copy</strong></a>,
<a href="vm_deallocate.html"><strong>vm_deallocate</strong></a>,
<a href="vm_write.html"><strong>vm_write</strong></a>.
